<template>
  <el-dialog :title="editType === 'new' ? '添加投放信息' : '修改投放信息'"
    width="500px" :visible="true" :close-on-click-modal="false" @close="closeDialog(false)">
    <el-form :model="formInfo" label-position="left" label-width="100px">
      <!-- // 种类（包括苗、饲料、药物等下拉菜单）、名称、数量、来源 -->
      <el-form-item label="网箱编号:">
        <el-input size="small" v-model="formInfo.boxId" disabled></el-input>
      </el-form-item>
      <el-form-item label="网箱名称:">
        <el-select v-model="formInfo.boxName" size="small" style="width: 100%" :disabled="editType !== 'new'">
          <el-option value="网箱一号" >网箱一号</el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="投放日期:">
        <el-input size="small" v-model="formInfo.date"></el-input>
      </el-form-item>
      <el-form-item label="种类:">
        <el-select style="width: 100%" v-model="formInfo.type" size="small">
          <el-option value="苗">苗</el-option>
          <el-option value="饲料">饲料</el-option>
          <el-option value="药物">药物</el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="名称:">
        <el-input size="small" v-model="formInfo.name"></el-input>
      </el-form-item>
      <el-form-item label="数量:">
        <el-input size="small" v-model="formInfo.count"></el-input>
      </el-form-item>
      <el-form-item label="来源:">
        <el-input size="small" v-model="formInfo.source"></el-input>
      </el-form-item>
    </el-form>
     <span slot="footer" class="dialog-footer">
      <el-button
        type="primary"
        class="mr10"
        size="small"
      >
        确定
      </el-button>
      <el-button
        type="default"
        size="small"
        @click="closeDialog(false)"
      >
        取消
      </el-button>
    </span>
  </el-dialog>
</template>
<script>
export default {
  props: {
    editType: String,
    row: Object
  },
  created () {
    if (this.editType !== 'new') {
      Object.assign(this.formInfo, this.row)
    }
  },
  data () {
    return {
      formInfo: {

      }
    }
  },
  methods: {
    closeDialog (flag = false) {
      const info = {
        type: 'launchModal',
        update: flag
      }
      this.$emit('modal-close', info)
    }
  }
}
</script>
